import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { Access } from './common/modules/access/entities/access.entity';
import { RoleAccess } from './common/modules/access/entities/role-access.entity';
import { AuthModule } from './common/modules/auth/auth.module';
import { Role } from './common/modules/role/entities/role.entity';
import { UserRole } from './common/modules/role/entities/user-role.entity';
import { RoleModule } from './common/modules/role/role.module';
import { User } from './common/modules/user/entities/user.entity';
import { UserModule } from './common/modules/user/user.module';
import { VisualModule } from './common/modules/visualized/visual.module';

@Module({
    imports: [
        UserModule,
        RoleModule,
        AuthModule,
        VisualModule,
        TypeOrmModule.forRoot({
            type: 'mysql',
            host: 'localhost',
            port: 3306,
            username: 'root',
            password: 'wjjabc1534.',
            database: 'rbac',
            entities: [
                User,
                UserRole,
                Role,
                Access,
                RoleAccess
            ],
            synchronize: true,
        }),
    ],
    controllers: [AppController],
    providers: [AppService],
})
export class AppModule { }
